<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.1, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- Copyright © 1988-2023 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "Funding Free Software", the Front-Cover
Texts being (a) (see below), and with the Back-Cover Texts being (b)
(see below).  A copy of the license is included in the section entitled
"GNU Free Documentation License".

(a) The FSF's Front-Cover Text is:

A GNU Manual

(b) The FSF's Back-Cover Text is:

You have freedom to copy and modify this GNU Manual, like GNU
     software.  Copies published by the Free Software Foundation raise
     funds for GNU development. -->
<title>Miscellaneous routines (GNU Compiler Collection (GCC) Internals)</title>

<meta name="description" content="Miscellaneous routines (GNU Compiler Collection (GCC) Internals)">
<meta name="keywords" content="Miscellaneous routines (GNU Compiler Collection (GCC) Internals)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">

<link href="index.html" rel="start" title="Top">
<link href="Option-Index.html" rel="index" title="Option Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Libgcc.html" rel="up" title="Libgcc">
<link href="Exception-handling-routines.html" rel="prev" title="Exception handling routines">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
div.example {margin-left: 3.2em}
span:hover a.copiable-link {visibility: visible}
strong.def-name {font-family: monospace; font-weight: bold; font-size: larger}
-->
</style>


</head>

<body lang="en">
<div class="section-level-extent" id="Miscellaneous-routines">
<div class="nav-panel">
<p>
Previous: <a href="Exception-handling-routines.html" accesskey="p" rel="prev">Language-independent routines for exception handling</a>, Up: <a href="Libgcc.html" accesskey="u" rel="up">The GCC low-level runtime library</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<h3 class="section" id="Miscellaneous-runtime-library-routines"><span>4.6 Miscellaneous runtime library routines<a class="copiable-link" href="#Miscellaneous-runtime-library-routines"> &para;</a></span></h3>

<ul class="mini-toc">
<li><a href="#Cache-control-functions" accesskey="1">Cache control functions</a></li>
<li><a href="#Split-stack-functions-and-variables" accesskey="2">Split stack functions and variables</a></li>
</ul>
<div class="subsection-level-extent" id="Cache-control-functions">
<h4 class="subsection"><span>4.6.1 Cache control functions<a class="copiable-link" href="#Cache-control-functions"> &para;</a></span></h4>
<dl class="first-deftypefn">
<dt class="deftypefn" id="index-_005f_005fclear_005fcache"><span class="category-def">Runtime Function: </span><span><code class="def-type">void</code> <strong class="def-name">__clear_cache</strong> <code class="def-code-arguments">(char *<var class="var">beg</var>, char *<var class="var">end</var>)</code><a class="copiable-link" href="#index-_005f_005fclear_005fcache"> &para;</a></span></dt>
<dd><p>This function clears the instruction cache between <var class="var">beg</var> and <var class="var">end</var>.
</p></dd></dl>

</div>
<div class="subsection-level-extent" id="Split-stack-functions-and-variables">
<h4 class="subsection"><span>4.6.2 Split stack functions and variables<a class="copiable-link" href="#Split-stack-functions-and-variables"> &para;</a></span></h4>
<dl class="first-deftypefn">
<dt class="deftypefn" id="index-_005f_005fsplitstack_005ffind"><span class="category-def">Runtime Function: </span><span><code class="def-type">void *</code> <strong class="def-name">__splitstack_find</strong> <code class="def-code-arguments">(void *<var class="var">segment_arg</var>, void *<var class="var">sp</var>, size_t <var class="var">len</var>, void **<var class="var">next_segment</var>, void **<var class="var">next_sp</var>, void **<var class="var">initial_sp</var>)</code><a class="copiable-link" href="#index-_005f_005fsplitstack_005ffind"> &para;</a></span></dt>
<dd><p>When using <samp class="option">-fsplit-stack</samp>, this call may be used to iterate
over the stack segments.  It may be called like this:
</p><div class="example smallexample">
<pre class="example-preformatted">  void *next_segment = NULL;
  void *next_sp = NULL;
  void *initial_sp = NULL;
  void *stack;
  size_t stack_size;
  while ((stack = __splitstack_find (next_segment, next_sp,
                                     &amp;stack_size, &amp;next_segment,
                                     &amp;next_sp, &amp;initial_sp))
         != NULL)
    {
      /* Stack segment starts at stack and is
         stack_size bytes long.  */
    }
</pre></div>

<p>There is no way to iterate over the stack segments of a different
thread.  However, what is permitted is for one thread to call this
with the <var class="var">segment_arg</var> and <var class="var">sp</var> arguments NULL, to pass
<var class="var">next_segment</var>, <var class="var">next_sp</var>, and <var class="var">initial_sp</var> to a different
thread, and then to suspend one way or another.  A different thread
may run the subsequent <code class="code">__splitstack_find</code> iterations.  Of
course, this will only work if the first thread is suspended while the
second thread is calling <code class="code">__splitstack_find</code>.  If not, the second
thread could be looking at the stack while it is changing, and
anything could happen.
</p></dd></dl>

<dl class="first-defvr first-defvar-alias-first-defvr">
<dt class="defvr defvar-alias-defvr" id="index-_005f_005fmorestack_005fsegments"><span class="category-def">Variable: </span><span><strong class="def-name">__morestack_segments</strong><a class="copiable-link" href="#index-_005f_005fmorestack_005fsegments"> &para;</a></span></dt>
<dt class="defvrx defvarx-alias-defvrx def-cmd-defvr" id="index-_005f_005fmorestack_005fcurrent_005fsegment"><span class="category-def">Variable: </span><span><strong class="def-name">__morestack_current_segment</strong><a class="copiable-link" href="#index-_005f_005fmorestack_005fcurrent_005fsegment"> &para;</a></span></dt>
<dt class="defvrx defvarx-alias-defvrx def-cmd-defvr" id="index-_005f_005fmorestack_005finitial_005fsp"><span class="category-def">Variable: </span><span><strong class="def-name">__morestack_initial_sp</strong><a class="copiable-link" href="#index-_005f_005fmorestack_005finitial_005fsp"> &para;</a></span></dt>
<dd><p>Internal variables used by the <samp class="option">-fsplit-stack</samp> implementation.
</p></dd></dl>

</div>
</div>
<hr>
<div class="nav-panel">
<p>
Previous: <a href="Exception-handling-routines.html">Language-independent routines for exception handling</a>, Up: <a href="Libgcc.html">The GCC low-level runtime library</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>
